package com.free.normal;

import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.RowLayout;
import org.eclipse.swt.widgets.Combo;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;

/**
 * <p>
 * Title: Eclipse Plugin Development
 * </p>
 * <p>
 * Description: Free download
 * </p>
 * <p>
 * mail: ganshm@gmail.com
 * </p>
 */

public class HelloWorldCombo
{
    
    // 下拉列表项
    private static final String[] ITEMS = {"Alpha", "Bravo", "Charlie", "Delta", "Echo", "Foxtrot", "Golf", "Hotel", "India", "Juliet", "Kilo", "Lima", "Mike", "November", "Oscar", "Papa", "Quebec", "Romeo", "Sierra", "Tango", "Uniform",
        "Victor", "Whiskey", "X-Ray", "Yankee", "Zulu"};
    
    public static void main(String[] args)
    {
        Display display = new Display();
        Shell shell = new Shell(display);
        shell.setLayout(new RowLayout());
        // 添加通过下拉按钮风格的下拉列表框
        Combo combo = new Combo(shell, SWT.DROP_DOWN);
        // 设置下拉列表项
        combo.setItems(ITEMS);
        
        // 添加只读风格的下拉列表框
        Combo readOnly = new Combo(shell, SWT.DROP_DOWN | SWT.READ_ONLY);
        // 设置下拉列表项
        readOnly.setItems(ITEMS);
        
        // 添加无下拉按钮风格的下拉列表框
        Combo simple = new Combo(shell, SWT.SIMPLE);
        // 设置下拉列表项
        simple.setItems(ITEMS);
        shell.open();
        while (!shell.isDisposed())
        {
            if (!display.readAndDispatch())
            {
                display.sleep();
            }
        }
        display.dispose();
    }
}
